home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 10695 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.0 KB

  1. Path: EU.net!sun4nl!xs4all!falstaff
  2. From: falstaff@xs4all.nl (Falstaff)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Q about the float point format......
  5. Date: 19 Mar 1996 14:51:19 GMT
  6. Organization: XS4ALL, networking for the masses
  7. Message-ID: <4imhl7$jcf@news.xs4all.nl>
  8. References: <s3032089.15.314E68DD@sparc13.ncu.edu.tw>
  9. NNTP-Posting-Host: xs1.xs4all.nl
  10. X-Newsreader: NN version 6.5.0 #666 (NOV)
  11.  
  12. s3032089@sparc13.ncu.edu.tw (Alexander PeaceLand) writes:
  13.  
  14.  
  15. >   Could I dynamicly set the digits after the float POINT?
  16.  
  17. >   In other word... I use printf to print the float point number
  18. >                    like 123.456789 but in the other time i only 
  19. >                    want to print 123.456 or 123.4 
  20. >                    How shall I do? Thanks! :)
  21.  
  22.    i=3;  /* or whatever */
  23.    printf("%.*f",123.456789,i);
  24.  
  25. That should work.
  26.  
  27. Frank
  28. --
  29. The famous GIICM now on line:  http://www.xs4all.nl/~falstaff/GIICM.html
  30. ------------------------------------------------------------------------
  31. Frank A. Vorstenbosch        +31-(70)-355 5241        falstaff@xs4all.nl
  32.